package com.example.demo.controller;

import com.example.demo.service.EmailService;
import com.example.demo.utill.ResponseResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/send")
public class SendEmailController {

    @Resource
    private EmailService emailService;

    @RequestMapping("/email")
    @ResponseBody
    public ResponseResult sendEmail(String email){
        ResponseResult res=new ResponseResult();
        boolean s=emailService.sendSimpleMail(email);
        if(s){
            res.setMessage("发送成功");
        }else{
            res.setMessage("发送失败");
        }
        return res;
    }
}
